From 81229a1b0b113bd8977aa882e6876f8684adaab6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 22 Oct 2004 17:27:06 +0000 Subject: [PATCH] Document how to use info with text/image targets. 2004-10-22 Matthias Clasen * gtk/gtkdnd.c: Document how to use info with text/image targets. * gtk/gtkselection.h: * gtk/gtkselection.c (gtk_target_list_add_text_targets): (gtk_target_list_add_image_targets): Add info argument. * gtk/gtkcalendar.c (gtk_calendar_motion_notify): * gtk/gtkentry.c (gtk_entry_init): * gtk/gtktextview.c (gtk_text_view_init): Adjust all callers. --- ChangeLog | 13 +++++++++++++ ChangeLog.pre-2-10 | 13 +++++++++++++ ChangeLog.pre-2-6 | 13 +++++++++++++ ChangeLog.pre-2-8 | 13 +++++++++++++ gtk/gtkcalendar.c | 2 +- gtk/gtkdnd.c | 28 ++++++++++++++++++++-------- gtk/gtkentry.c | 2 +- gtk/gtkselection.c | 28 +++++++++++++++------------- gtk/gtkselection.h | 4 +++- gtk/gtktextview.c | 2 +- 10 files changed, 93 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f0cd76be6..a8bbe98bbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-10-22 Matthias Clasen + + * gtk/gtkdnd.c: Document how to use info with text/image + targets. + + * gtk/gtkselection.h: + * gtk/gtkselection.c (gtk_target_list_add_text_targets): + (gtk_target_list_add_image_targets): Add info argument. + + * gtk/gtkcalendar.c (gtk_calendar_motion_notify): + * gtk/gtkentry.c (gtk_entry_init): + * gtk/gtktextview.c (gtk_text_view_init): Adjust all callers. + 2004-10-22 Anders Carlsson * gtk/gtktexttag.c: (gtk_text_tag_get_property): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 7f0cd76be6..a8bbe98bbd 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +2004-10-22 Matthias Clasen + + * gtk/gtkdnd.c: Document how to use info with text/image + targets. + + * gtk/gtkselection.h: + * gtk/gtkselection.c (gtk_target_list_add_text_targets): + (gtk_target_list_add_image_targets): Add info argument. + + * gtk/gtkcalendar.c (gtk_calendar_motion_notify): + * gtk/gtkentry.c (gtk_entry_init): + * gtk/gtktextview.c (gtk_text_view_init): Adjust all callers. + 2004-10-22 Anders Carlsson * gtk/gtktexttag.c: (gtk_text_tag_get_property): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 7f0cd76be6..a8bbe98bbd 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +2004-10-22 Matthias Clasen + + * gtk/gtkdnd.c: Document how to use info with text/image + targets. + + * gtk/gtkselection.h: + * gtk/gtkselection.c (gtk_target_list_add_text_targets): + (gtk_target_list_add_image_targets): Add info argument. + + * gtk/gtkcalendar.c (gtk_calendar_motion_notify): + * gtk/gtkentry.c (gtk_entry_init): + * gtk/gtktextview.c (gtk_text_view_init): Adjust all callers. + 2004-10-22 Anders Carlsson * gtk/gtktexttag.c: (gtk_text_tag_get_property): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 7f0cd76be6..a8bbe98bbd 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +2004-10-22 Matthias Clasen + + * gtk/gtkdnd.c: Document how to use info with text/image + targets. + + * gtk/gtkselection.h: + * gtk/gtkselection.c (gtk_target_list_add_text_targets): + (gtk_target_list_add_image_targets): Add info argument. + + * gtk/gtkcalendar.c (gtk_calendar_motion_notify): + * gtk/gtkentry.c (gtk_entry_init): + * gtk/gtktextview.c (gtk_text_view_init): Adjust all callers. + 2004-10-22 Anders Carlsson * gtk/gtktexttag.c: (gtk_text_tag_get_property): diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index d463314df0..4c770c2e7c 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -2816,7 +2816,7 @@ gtk_calendar_motion_notify (GtkWidget *widget, { GdkDragContext *context; GtkTargetList *target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (target_list); + gtk_target_list_add_text_targets (target_list, 0); context = gtk_drag_begin (widget, target_list, GDK_ACTION_COPY, 1, (GdkEvent *)event); diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 60b88ceac0..a2edb049ea 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -1030,7 +1030,10 @@ gtk_drag_dest_set_target_list (GtkWidget *widget, * @widget: a #GtkWidget that's a drag destination * * Add the text targets supported by #GtkSelection to - * the target list of the drag destination. + * the target list of the drag destination. The targets + * are added with @info = 0. If you need another value, + * use gtk_target_list_add_text_targets() and + * gtk_drag_dest_set_target_list(). * * Since: 2.6 **/ @@ -1044,7 +1047,7 @@ gtk_drag_dest_add_text_targets (GtkWidget *widget) gtk_target_list_ref (target_list); else target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (target_list); + gtk_target_list_add_text_targets (target_list, 0); gtk_drag_dest_set_target_list (widget, target_list); gtk_target_list_unref (target_list); } @@ -1054,7 +1057,10 @@ gtk_drag_dest_add_text_targets (GtkWidget *widget) * @widget: a #GtkWidget that's a drag destination * * Add the image targets supported by #GtkSelection to - * the target list of the drag destination. + * the target list of the drag destination. The targets + * are added with @info = 0. If you need another value, + * use gtk_target_list_add_image_targets() and + * gtk_drag_dest_set_target_list(). * * Since: 2.6 **/ @@ -1068,7 +1074,7 @@ gtk_drag_dest_add_image_targets (GtkWidget *widget) gtk_target_list_ref (target_list); else target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_image_targets (target_list, FALSE); + gtk_target_list_add_image_targets (target_list, 0, FALSE); gtk_drag_dest_set_target_list (widget, target_list); gtk_target_list_unref (target_list); } @@ -2221,7 +2227,10 @@ gtk_drag_source_set_target_list (GtkWidget *widget, * @widget: a #GtkWidget that's is a drag source * * Add the text targets supported by #GtkSelection to - * the target list of the drag source. + * the target list of the drag source. The targets + * are added with @info = 0. If you need another value, + * use gtk_target_list_add_text_targets() and + * gtk_drag_dest_set_target_list(). * * Since: 2.6 **/ @@ -2235,7 +2244,7 @@ gtk_drag_source_add_text_targets (GtkWidget *widget) gtk_target_list_ref (target_list); else target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_text_targets (target_list); + gtk_target_list_add_text_targets (target_list, 0); gtk_drag_source_set_target_list (widget, target_list); gtk_target_list_unref (target_list); } @@ -2245,7 +2254,10 @@ gtk_drag_source_add_text_targets (GtkWidget *widget) * @widget: a #GtkWidget that's is a drag source * * Add the writable image targets supported by #GtkSelection to - * the target list of the drag source. + * the target list of the drag source. The targets + * are added with @info = 0. If you need another value, + * use gtk_target_list_add_text_targets() and + * gtk_drag_dest_set_target_list(). * * Since: 2.6 **/ @@ -2259,7 +2271,7 @@ gtk_drag_source_add_image_targets (GtkWidget *widget) gtk_target_list_ref (target_list); else target_list = gtk_target_list_new (NULL, 0); - gtk_target_list_add_image_targets (target_list, TRUE); + gtk_target_list_add_image_targets (target_list, 0, TRUE); gtk_drag_source_set_target_list (widget, target_list); gtk_target_list_unref (target_list); } diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index b586e7a53c..aea064ec52 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1684,7 +1684,7 @@ gtk_entry_motion_notify (GtkWidget *widget, GtkTargetList *target_list = gtk_target_list_new (NULL, 0); guint actions = entry->editable ? GDK_ACTION_COPY | GDK_ACTION_MOVE : GDK_ACTION_COPY; - gtk_target_list_add_text_targets (target_list); + gtk_target_list_add_text_targets (target_list, 0); context = gtk_drag_begin (widget, target_list, actions, entry->button, (GdkEvent *)event); diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c index 44f39e3b2b..b792a3cf93 100644 --- a/gtk/gtkselection.c +++ b/gtk/gtkselection.c @@ -270,15 +270,16 @@ init_atoms (void) /** * gtk_target_list_add_text_targets: * @list: a #GtkTargetList + * @info: an ID that will be passed back to the application * * Adds the text targets supported by #GtkSelection to - * the target list. The targets are added with both flags - * and info being zero. + * the target list. All targets are added with the same @info. * * Since: 2.6 **/ void -gtk_target_list_add_text_targets (GtkTargetList *list) +gtk_target_list_add_text_targets (GtkTargetList *list, + guint info) { g_return_if_fail (list != NULL); @@ -286,29 +287,30 @@ gtk_target_list_add_text_targets (GtkTargetList *list) /* Keep in sync with gtk_selection_data_targets_include_text() */ - gtk_target_list_add (list, utf8_atom, 0, 0); - gtk_target_list_add (list, ctext_atom, 0, 0); - gtk_target_list_add (list, text_atom, 0, 0); - gtk_target_list_add (list, GDK_TARGET_STRING, 0, 0); - gtk_target_list_add (list, text_plain_utf8_atom, 0, 0); - gtk_target_list_add (list, text_plain_locale_atom, 0, 0); - gtk_target_list_add (list, text_plain_atom, 0, 0); + gtk_target_list_add (list, utf8_atom, 0, info); + gtk_target_list_add (list, ctext_atom, 0, info); + gtk_target_list_add (list, text_atom, 0, info); + gtk_target_list_add (list, GDK_TARGET_STRING, 0, info); + gtk_target_list_add (list, text_plain_utf8_atom, 0, info); + gtk_target_list_add (list, text_plain_locale_atom, 0, info); + gtk_target_list_add (list, text_plain_atom, 0, info); } /** * gtk_target_list_add_image_targets: * @list: a #GtkTargetList + * @info: an ID that will be passed back to the application * @writable: whether to add only targets for which GTK+ knows * how to convert a pixbuf into the format * * Adds the image targets supported by #GtkSelection to - * the target list. The targets are added with both flags - * and info being zero. + * the target list. All targets are added with the same @info. * * Since: 2.6 **/ void gtk_target_list_add_image_targets (GtkTargetList *list, + guint info, gboolean writable) { GSList *formats, *f; @@ -330,7 +332,7 @@ gtk_target_list_add_image_targets (GtkTargetList *list, for (m = mimes; *m; m++) { atom = gdk_atom_intern (*m, FALSE); - gtk_target_list_add (list, atom, 0, 0); + gtk_target_list_add (list, atom, 0, info); } g_strfreev (mimes); } diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h index 02bbd8a0f0..12c341201d 100644 --- a/gtk/gtkselection.h +++ b/gtk/gtkselection.h @@ -95,8 +95,10 @@ void gtk_target_list_add (GtkTargetList *list, GdkAtom target, guint flags, guint info); -void gtk_target_list_add_text_targets (GtkTargetList *list); +void gtk_target_list_add_text_targets (GtkTargetList *list, + guint info); void gtk_target_list_add_image_targets (GtkTargetList *list, + guint info, gboolean writable); void gtk_target_list_add_table (GtkTargetList *list, const GtkTargetEntry *targets, diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 7e503bd98f..9efe99d5a5 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -5901,7 +5901,7 @@ gtk_text_view_start_selection_dnd (GtkTextView *text_view, target_list = gtk_target_list_new (target_table, G_N_ELEMENTS (target_table)); - gtk_target_list_add_text_targets (target_list); + gtk_target_list_add_text_targets (target_list, 0); context = gtk_drag_begin (GTK_WIDGET (text_view), target_list, GDK_ACTION_COPY | GDK_ACTION_MOVE, -- 2.30.2